<?php

namespace Biz\Requests\Site;

use Illuminate\Validation\Rule;
use Biz\Dictionaries\CurrencyDict;
use Biz\Constants\ApplicationConstants;
use Lumen\Validation\Rules\AttributeInRule;
use Lumen\Validation\Validators\RequestValidator;

/**
 * SiteRegistrationFeeRequest.
 *
 * @license [http://www.85do.com] [杭州永奥网络科技有限公司]
 * @copyright Copyright (c) 2018-2026 Hangzhou Yongao Technology Co., Ltd. All rights reserved.
 */
class SiteRegistrationFeeRequest extends RequestValidator
{
    /**
     * Get custom rules for validator errors.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'translations'                         => 'required',
            'translations.*'                       => [
                'required',
                new AttributeInRule(ApplicationConstants::$Languages),
            ],
            'translations.*.currency'               => [
                'required',
                'string',
                'distinct',
                'max:6',
                Rule::in(CurrencyDict::keys()),
            ],
            'translations.*.name'                          => 'required|string|max:255',
            'translations.*.price'                         => 'required|numeric|min:0',
            'translations.*.accompany_price'               => 'required|numeric|min:0',
            'translations.*.description'                   => 'max:255',
        ];
    }
}
